<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<script type="text/javascript">
	function cancelTo() {

		window.location.href = webRoot + '/deliverGoods/listFrame';
	}

	function saveThis(id) {
		var codeid = '#code' + id
		var nameid = "#name" + id
		var checkid = "#check" + id

		var code = $(codeid).val();
		var name = $(nameid).val();
		var check = $(checkid).is(':checked')

		$.ajax({
			type : 'post',
			url : webRoot + '/logistics/save',
			data : {
				"id" : id,
				"name" : name,
				"code" : code,
				"type" : check
			},
			dataType : 'json',
			success : function(data) {

				cancelTo()
			}
		});

	}
</script>
<div class="body-content-box">
	<table class="table table-striped table-hover table-info">
		<thead>
			<tr>
				<th>代码</th>
				<th>名称</th>
				<th>跟踪号</th>
				<th>启用</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${dlist}" var="log" varStatus="vs">
				<tr>
					<td><input type="text" value="${log.code}" id="code${log.id}" /></td>
					<td><input type="text" value="${log.name}" id="name${log.id}" /></td>
					<td><c:if test="${log.type=='1'}">有</c:if> <c:if
							test="${log.type=='0'}">无</c:if></td>
					<td><c:if test="${log.type=='1'}">
							<input type="checkbox" id="check${log.id}" checked />
						</c:if> <c:if test="${log.type=='0'}">
							<input type="checkbox" id="check${log.id}" />
						</c:if></td>
					<td><a onclick="saveThis('${log.id}')">保存</a><a
						style="margin-left: 10px;" onclick="cancelTo()">返回</a></td>
				</tr>
			</c:forEach>

		</tbody>
	</table>
</div>
